package com.wang.vagus.config;

import com.wang.vagus.filter.JwtAuthenticationTokenFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    @Autowired
    protected JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter;

    @Bean
    public FilterRegistrationBean jwtFilter() {
        final FilterRegistrationBean<JwtAuthenticationTokenFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(jwtAuthenticationTokenFilter);
        registrationBean.addUrlPatterns("/*");

        return registrationBean;
    }



}

